.. _`Linear Discriminant Analysis`: .. _`com.sympathyfordata.advancedmachinelearning.linear_discriminant_analysis`: Linear Discriminant Analysis ```````````````````````````` .. image:: LDA.svg :width: 48 Constructs linear combinations of features that separates two or more classes. Can used either as a linear classifier or, more commonly, as a dimensionality reduction technique. For dimensionality reduction it requires a Y input to the fit_transform node Documentation ::::::::::::: Attributes ========== **classes_** Unique class labels. **coef_** Weight vector(s). **covariance_** Weighted within-class covariance matrix. It corresponds to `sum_k prior_k * C_k` where `C_k` is the covariance matrix of the samples in class `k`. The `C_k` are estimated using the (potentially shrunk) biased estimator of covariance. If solver is 'svd', only exists when `store_covariance` is True. **explained_variance_ratio_** Percentage of variance explained by each of the selected components. If ``n_components`` is not set then all components are stored and the sum of explained variances is equal to 1.0. Only available when eigen or svd solver is used. **intercept_** Intercept term. **means_** Class-wise means. **priors_** Class priors (sum to 1). **scalings_** Scaling of the features in the space spanned by the class centroids. Only available for 'svd' and 'eigen' solvers. **xbar_** Overall mean. Only present if solver is 'svd'. Definition :::::::::: Output ports ============ **model** model Model Configuration ============= **N. of components for dimensionality reduction** (n_components) Number of components (<= min(n_classes - 1, n_features)) for dimensionality reduction. If None, will be set to min(n_classes - 1, n_features). This parameter only affects the `transform` method. For a usage example, see sphx_glr_auto_examples_decomposition_plot_pca_vs_lda.py. **Shrinkage parameter** (shrinkage) Shrinkage parameter, possible values: - None: no shrinkage (default). - 'auto': automatic shrinkage using the Ledoit-Wolf lemma. - float between 0 and 1: fixed shrinkage parameter. This should be left to None if `covariance_estimator` is used. Note that shrinkage works only with 'lsqr' and 'eigen' solvers. For a usage example, see sphx_glr_auto_examples_classification_plot_lda.py. **Solver to use** (solver) Solver to use, possible values: - 'svd': Singular value decomposition (default). Does not compute the covariance matrix, therefore this solver is recommended for data with a large number of features. - 'lsqr': Least squares solution. Can be combined with shrinkage or custom covariance estimator. - 'eigen': Eigenvalue decomposition. Can be combined with shrinkage or custom covariance estimator. .. versionchanged:: 1.2 `solver="svd"` now has experimental Array API support. See the Array API User Guide for more details. **Store covariance** (store_covariance) If True, explicitly compute the weighted within-class covariance matrix when solver is 'svd'. The matrix is always computed and stored for the other solvers. .. versionadded:: 0.17 **Tolerance** (tol) Absolute threshold for a singular value of X to be considered significant, used to estimate the rank of X. Dimensions whose singular values are non-significant are discarded. Only used if solver is 'svd'. .. versionadded:: 0.17 Examples ======== * :download:`Fisher_faces.syx ` Implementation ============== .. automodule:: node_discriminant_analysis :noindex: .. class:: LinearDiscriminantAnalysis :noindex: